home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2000 February / Macworld (2000-02).dmg / Updaters / WhiteCap 3.2.2.sea / WhiteCap 3.2.2 / WhiteCap Source / WhiteCap MooV.cpp < prev    next >
C/C++ Source or Header  |  1999-10-16  |  4KB  |  164 lines

  1. #include <iostream>
  2. #include "EGOSUtils.h"
  3. #include "WhiteCap.h"
  4.  
  5. #include <OSUtils.h>
  6.  
  7.  
  8.  
  9. #if MACAMP
  10. #include "MacAMP_Visual.h"
  11.  
  12. VPInfoBlock gPlugInfo =
  13. {
  14.     VP_INFOBLOCK_HEADER( 0, 0),
  15.  
  16.     "\p",
  17.     nil,
  18.     nil,
  19.     nil,                // we don't idle
  20.     nil,
  21.     nil,
  22.     nil,
  23.     
  24.     nil,            // we don't want keydowns..
  25.     nil,        // ...and events
  26.     nil,
  27.     nil,                // we have no settings
  28.     nil,
  29.     nil,
  30.     
  31.     // Nifty macro to set all these 'reserved' values for us
  32.     VP_INFOBLOCK_FOOTER
  33. };
  34.  
  35. #endif
  36.  
  37.  
  38. using namespace std;  //introduces namespace std
  39.  
  40.  
  41. int main()
  42. {    
  43.     char c[ 10 ];
  44.     bool ok;
  45.     long importNumBins, x, y;
  46.     CEgFileSpec spec;
  47.     CEgIFile iFile;
  48.     UtilStr    str;
  49.     WhiteCap* WC;
  50.     WindowPtr wind;
  51.     Rect r;
  52.     
  53.     // Print some how-to info...
  54.     cout << "This utility accepts a capture file saved by WhiteCap.  To make of movie of a WhiteCap clip: " << endl;
  55.     cout << "1)  Open the WhiteCap Prefences file (in your Preferences folder)" << endl;
  56.     cout << "2)  Set the 'Capt' parameter to 1 and save the changes." << endl;
  57.     cout << "3)  Run WhiteCap (it should say 'Capturing').  Change configs as if WhiteCap was running normally--it will be recording all the data it needs to disk." << endl;
  58.     cout << "4)  When you close WhiteCap, it will flush all its recorded data to the file 'WhiteCap Capture'" << endl;
  59.     cout << "5)  Run this program and create a PICT sequence.  (The depth of the sequence is whatever your monitor depth is when you run this utility)" << endl;
  60.     cout << "6)  Import this sequence in MooVer and you'll be able to output a quicktime movie." << endl << endl;
  61.     
  62.     // Call global inits/startups...
  63.     EgOSUtils::Initialize();
  64.     PixPort::Startup();
  65.     CEgFileSpec folder;
  66.     folder.AssignFolder( "WhiteCap Configs" );
  67.     WC = new WhiteCap( folder );
  68.     wind = ::NewCWindow( NULL, &r, "\pWhiteCap", false, plainDBox,    (WindowPtr)-1, true, NULL );
  69.     WC -> SetWinPort( wind );
  70.  
  71.     cout << "Press return to load a WhiteCap Capture file...";
  72.     GetDateTime( (unsigned long*) &qd.randSeed );
  73.     cin >> c;
  74.  
  75.     ok = EgOSUtils::AskOpen( NULL, spec, cWC_CaptureType );
  76.     if ( ok ) {
  77.         iFile.open( &spec );
  78.         if ( iFile.noErr() ) {
  79.             ok = false;
  80.             
  81.             if ( iFile.GetLong() == (long) cWhiteCapID ) {
  82.                 if ( iFile.GetLong() == WHITECAP_COMPAT_VERSION ) {
  83.                     importNumBins = iFile.GetLong();
  84.                     ok = importNumBins == NUM_SAMPLE_BINS;
  85.                 }
  86.             }
  87.                         
  88.             if ( ok ) {
  89.                 
  90.                 cout << "Enter sequence width (in pixels) --> ";
  91.                 cin >> x; 
  92.                 if ( x < 64 )
  93.                     x = 64;
  94.                 cout << endl << "Enter sequence height (in pixels) --> ";
  95.                 cin >> y;
  96.                 if ( y < 64 )
  97.                     y = 64;
  98.  
  99.                 // Resize whitecap's window...
  100.                 WC -> GetWinRect( r );
  101.                 r.right     = r.left + x;
  102.                 r.bottom    = r.top + y;
  103.                 WC -> SetWinPort( wind, &r );
  104.  
  105.                 cout << "Beginning processing..." << cout;
  106.                 WC -> DoDump( &iFile, importNumBins, 30 );
  107.                 str.Assign( "End Capture file processing." ); }
  108.             else
  109.                 str.Assign( "Corrupt or incompatible capture file." );
  110.             }
  111.         else
  112.             iFile.GetErrStr( str );
  113.         
  114.         cout << str.getCStr();
  115.     }
  116.     
  117.     return 0;
  118. }
  119.  
  120.  
  121.  
  122.  
  123. /*
  124.  
  125. int main(void)
  126. {
  127.     GrafPort win;
  128.     WindowPtr winP = &win;
  129.     unsigned long    num, N = NUM_SAMPLE_BINS;
  130.     FSSpec spec;
  131.  
  132.     for ( num = 0; num < N; num++ )
  133.         gDummyFFT[ num ] = 0;
  134.     
  135.     Initialize();
  136.     gPlugInfo.ma = new VPCallbacks;
  137.     gPlugInfo.ma -> GetFFT = dummyGetFFT;
  138.     gPlugInfo.ma -> GetStatus = NULL; 
  139.     gPlugInfo.ma -> EnterFullScreen = NULL;
  140.     gPlugInfo.ma -> ExitFullScreen = NULL;
  141.     
  142.     VisInitialize( &spec, &winP, &num );
  143.  
  144.     
  145.     do {
  146.         VisDraw( winP, &num );
  147.         long n = EgOSUtils::Rnd( 0, N-1 );
  148.         gDummyFFT[ n ] += .011 * EgOSUtils::Rnd( 0, 100 );
  149.         for ( num = 0; num < N; num++ ) {
  150.             gDummyFFT[ num ] = .8 * gDummyFFT[ num ];
  151.         }
  152.     } while (!Button());
  153.  
  154.     VisTerminate( winP, &num );
  155.     
  156.     delete gPlugInfo.ma;
  157.     
  158.     return 0;    
  159. }
  160.  
  161.  
  162.  
  163.  
  164. */